package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperatePropertyPackageDTO;
import com.itlong.cloud.POJO.PO.PropertyPackagePO;
import com.itlong.cloud.noncore.operate.IOperatePropertyPackageServiceClient;
import com.itlong.cloud.operate.service.IOperatePropertyPackageService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      运营-物业套餐管理业务处理接口暴露实现类
 * </desc>
 *
 * @createDate2020/3/23
 **/
@RestController
public class OperatePropertyPackageServiceResource implements IOperatePropertyPackageServiceClient {

    @Autowired
    private IOperatePropertyPackageService iOperatePropertyPackageService;

    /**
     * <desc>
     *      获取物业套餐列表
     * </desc>
     *
     * @param operatePropertyPackageDTO 查询参数实体
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/24
     */
    @Override
    @PostMapping("/operate/packageManage/propertyPackage/getPage")
    public Page<PropertyPackagePO> getPage(@RequestBody OperatePropertyPackageDTO operatePropertyPackageDTO) throws Exception {
        return iOperatePropertyPackageService.getPage(operatePropertyPackageDTO);
    }

    /**
     * <desc>
     *      更新物业套餐
     * </desc>
     *
     * @param propertyPackagePO 参数实体
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/24
     */
    @Override
    @PostMapping("/operate/packageManage/propertyPackage/update")
    public Integer update(@RequestBody PropertyPackagePO propertyPackagePO) throws Exception {
        return iOperatePropertyPackageService.update(propertyPackagePO);
    }

    /**
     * <desc>
     *      保存物业套餐
     * </desc>
     *
     * @param propertyPackagePO 参数实体
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/24
     */
    @Override
    @PostMapping("/operate/packageManage/propertyPackage/save")
    public Integer save(@RequestBody PropertyPackagePO propertyPackagePO) throws Exception {
        return iOperatePropertyPackageService.save(propertyPackagePO);
    }

    /**
     * <desc>
     *      删除物业套餐信息
     * </desc>
     *
     * @param propertyPackageIds 物业套餐id，多个逗号隔开
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/24
     */
    @Override
    @PostMapping("/operate/packageManage/propertyPackage/delete")
    public Integer delete(@RequestParam("propertyPackageIds") String propertyPackageIds) throws Exception {
        return iOperatePropertyPackageService.delete(propertyPackageIds);
    }

//    /**
//     * <desc>
//     *      获取物业套餐绑定的账号
//     * </desc>
//     *
//     * @param propertyPackageId 物业套餐id
//     * @return
//     * @Author Zhu.yj
//     * @createDate  2020/3/24
//     */
//    @Override
//    @PostMapping("/operate/packageManage/propertyPackage/getPropertyPackageAccount")
//    public List<String> getPropertyPackageAccount(@RequestParam String propertyPackageId) throws Exception {
//        return iOperatePropertyPackageService.getPropertyPackageAccount(propertyPackageId);
//    }

//    /**
//     * <desc>
//     *      获取物业账号下的套餐列表
//     * </desc>
//     *
//     * @return 套餐id，套餐名称
//     * @Author Zhu.yj
//     * @createDate  2020/3/25
//     */
//    @Override
//    @PostMapping("/operate/packageManage/propertyPackage/getPackage")
//    public List<OperatePropertyPackageVO> getPackage(@RequestParam("projectId") String projectId) throws Exception{
//        return iOperatePropertyPackageService.getPackage(projectId);
//    }

    /**
     * <desc>
     *      物业套餐分配功能
     * </desc>
     *
     * @param propertyFunctionIds 物业功能菜单id，多个逗号隔开
     * @param propertyPackageId  物业套餐id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/25
     */
    @Override
    @PostMapping("/operate/packageManage/propertyPackage/allotPropertyFunction")
    public Integer allotPropertyFunction(@RequestParam("propertyFunctions") String propertyFunctionIds,
                                         @RequestParam("propertyPackageId") String propertyPackageId) throws Exception{
        return iOperatePropertyPackageService.allotPropertyFunction(propertyFunctionIds, propertyPackageId);
    }

//    /**
//     * <desc>
//     *      套餐分配用户
//     * </desc>
//     *
//     * @param propertyPackageId 物业套餐id
//     * @param allotUserIds  分配的用户id 逗号隔开
//     * @param userIds 本页所有用户id，逗号隔开
//     * @return
//     * @Author Zhu.yj
//     * @createDate  2020/3/26
//     */
//    @Override
//    @PostMapping("/operate/packageManage/propertyPackage/allotPackageUser")
//    public Integer allotPackageUser(@RequestParam("propertyPackageId") String propertyPackageId,
//                                    @RequestParam("allotUserIds") String allotUserIds,
//                                    @RequestParam("userIds") String userIds) throws Exception{
//        return iOperatePropertyPackageService.allotPackageUser(propertyPackageId, allotUserIds, userIds);
//    }

    /**
     * <desc>
     *      获取单个物业套餐信息
     * </desc>
     *
     * @param propertyPackageId 物业套餐id
     * @return  单个物业套餐详细信息
     * @Author Zhu.yj
     * @createDate  2020/4/1
     */
    @Override
    @PostMapping("/operate/packageManage/propertyPackage/getOne")
    public PropertyPackagePO getOne(@RequestParam("propertyPackageId") String propertyPackageId) throws Exception {
        return iOperatePropertyPackageService.getOne(propertyPackageId);
    }

    /**
     * <desc>
     *      获取绑定了套餐的用户列表
     * </desc>
     *
     * @param propertyPackageId 物业套餐id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/4/3
     */
    @Override
    @PostMapping("/operate/packageManage/propertyPackage/getOther")
    public List<String> getOther(@RequestParam("propertyPackageId") String propertyPackageId) throws Exception{
        return iOperatePropertyPackageService.getOther(propertyPackageId);
    }
}
